import {reqHomeCate} from "../../http/api"

const state={
    cates:[]
}

const getters ={
    cates(state){
        return state.cates;
    }
}

const mutations={
    changeCates(state,cates){
        state.cates = cates;
    }
}

const actions={
    reqCates(context){
        reqHomeCate().then(res=>{
            if(res.data.code==200){
                context.commit("changeCates",res.data.list);
                // console.log(res);
            }
        })
    }
}


export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters,
}